package com.ethannhu.todaynews.entity.response

import com.ethannhu.todaynews.model.BaseViewModel

class ListResponse<T> : BaseResponse() {
    var data: Meta<T>? = null
}

suspend fun <T> ListResponse<T>.onSuccess(viewModel: BaseViewModel, action: suspend (data: Meta<T>) -> Unit) {
    if (isSuccess) {
        action(data!!)
    } else {
        viewModel._response.value = this
    }

}